package com.qingcheng.consumer;

import com.qingcheng.service.index.IndexService;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;
import org.springframework.beans.factory.annotation.Autowired;

//商品下架,监听队列收到消息后,将该商品对应的索引及数据从elasticsearch中删除
public class IndexDeleteConsumer implements MessageListener {

    @Autowired
    private IndexService indexService;

    public void onMessage(Message message) {
        String spuId = new String (message.getBody());
        System.err.println("-------------------DDDDDDDDD:"+spuId);
        indexService.deleteIndex(spuId);
    }
}
